package com.gy.edu.mine;

import android.view.View;
import android.widget.ListView;

import com.gy.edu.R;
import com.gy.edu.base.BaseActivity;
import com.gy.edu.home.adapter.HomeAdapter;
import com.gy.edu.home.bean.HomeBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 作者：gy on 16/12/22
 * 说明：
 */
public class MyAttentionActivity extends BaseActivity {

    private ListView listView;
    private View footerView,footerLine;
    private HomeAdapter adapter;
    private List<HomeBean> datas;

    @Override
    protected void initView() {
        setContentViewRes(R.layout.activity_my_attention);
        setTitleMsg("我的关注");
        listView = findView(R.id.my_attention_list);
        footerView = View.inflate(this,R.layout.home_footer,null);
        footerLine = footerView.findViewById(R.id.footer_line);
        footerLine.setVisibility(View.GONE);
    }

    @Override
    protected void initData() {
        datas = new ArrayList<>();
        String[] titles = mContext.getResources().getStringArray(R.array.home_title);
        String[] names = mContext.getResources().getStringArray(R.array.home_name);
        int[] numbers = mContext.getResources().getIntArray(R.array.home_number);
        int[] classs = mContext.getResources().getIntArray(R.array.home_class);
        for (int i = 0; i < titles.length / 2; i++) {
            HomeBean bean = new HomeBean();
            bean.title = titles[i];
            bean.name = names[i];
            bean.number = numbers[i]+"";
            bean.classs = classs[i]+"";
            datas.add(bean);
        }
        adapter = new HomeAdapter(mContext,datas);
    }

    @Override
    protected void fillData() {
        super.fillData();
        listView.addFooterView(footerView);
        listView.setAdapter(adapter);
    }
}
